package com.dream.testtubebaby.data.bbs;

import android.text.format.Time;

/**
 * Created by Administrator on 15-8-22.
 */
public class TopicLine {
    private int postId = -1;
    private int thumbnail = 0;
    private int userId;
    private String userName;
    private int avatar;
    private String avatarDateLine = "";
    private String postTime;
    private String postDay;
    private String message;

    public TopicLine(int postId, int thumbnail, int userId
            , String userName, int avatar, String avatarDateLine
            , String postTime, String postDay, String message) {
        this.postId = postId;
        this.thumbnail = thumbnail;
        this.userId = userId;
        this.userName = userName;
        this.avatar = avatar;
        this.avatarDateLine = avatarDateLine;
        this.postTime = postTime;
        this.postDay = postDay;
        this.message = message;
    }

    private String getHour() {
        Time time = new Time();
        time.setToNow();

        int hour12 = time.hour;
        if (time.hour > 12) {
            hour12 = time.hour - 12;
        }
        String hour = "" + ((hour12 > 10) ? hour12 : ("0" + hour12));
        return hour;
    }

    public String getUserName() {
        return userName;
    }

    public String getPostDate() {
        return postTime;
    }

    public String getMessage() {
        return message;
    }

    public static class TopicLineBuilder{
        private int postId = -1;
        private int thumbnail = 0;
        private int userId = 0;
        private String userName ="";
        private int avatar = 0;
        private String avatarDateLine = "";
        private String postTime = "";
        private String postDay = "";
        private String message = "";
        public TopicLineBuilder(){

        }

        public TopicLineBuilder PostId(int postId){
            this.postId = postId;
            return this;
        }

        public TopicLineBuilder UserId(int userId){
            this.userId = userId;
            return this;
        }

        public TopicLineBuilder UserName(String userName) {
            this.userName = userName;
            return this;
        }

        public TopicLineBuilder Message(String message) {
            this.message = message;
            return this;
        }

        public TopicLine build(){
            return new TopicLine(postId,thumbnail,userId,userName
                    ,avatar,avatarDateLine,postTime,postDay,message);
        }
    }


}
